/*
 * @Description: 
 */
import {
	mapState,
	mapGetters
} from 'vuex';
import {
	userInfos
} from '@/api/login'
let enterTime = '';
let outTime = '';
let stayTime = '';
export default {
	computed: {
		...mapState(['userInfo', 'systemInfo', 'locateInformation', 'loactionAddress', 'cityInfo']),
	},
	data() {
		return {
			upload: '/app-api/house/appConfig/upload-file',
			baseUrl: '',
			shareImage: '',
			navbarTitle: '',
			isLoadMore: false,
			query: {
				page: 1,
				limit: 10,
			},
			propertyType: [{
					value: 0,
					label: '普通住宅'
				},
				{
					value: 1,
					label: '商住'
				},
				{
					value: 2,
					label: '别墅'
				},
				{
					value: 3,
					label: '商铺'
				},
				{
					value: 4,
					label: '写字楼'
				}
			],
			prize_level: [{
					value: 0,
					label: '特等奖'
				},
				{
					value: 1,
					label: '一等奖'
				},
				{
					value: 2,
					label: '二等奖'
				},
				{
					value: 3,
					label: '三等奖'
				},
				{
					value: 4,
					label: '四等奖'
				},

			]
		};
	},
	onPageScroll(e) {
		if (e.scrollTop > 90) {
			this.navbarTitle = ''
		} else {
			this.navbarTitle = ''
		}
	},
	onShow() {
		// 用户进入时间
		enterTime = new Date();
		console.log('页面进入', enterTime.getTime());
	},
	onHide() {
		// 用户退出时间
		outTime = new Date();
		//停留时间(毫秒)
		stayTime = outTime.getTime() - enterTime.getTime();
		let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
		// console.log(routes, '===routes----onHide')
		if (routes.length > 0) {
			let curRoute = routes[routes.length - 1].route; //获取当前页面路由
			console.log('页面隐藏' + curRoute + '-----' + stayTime);
		}


	},
	onUnload() {
		// 用户退出时间
		outTime = new Date();
		//停留时间(毫秒)
		stayTime = outTime.getTime() - enterTime.getTime();
		let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
		// console.log(routes, '===routes---onUnload')
		if (routes.length > 0) {
			let curRoute = routes[routes.length - 1].route; //获取当前页面路由
			console.log('页面卸载' + curRoute + '------' + stayTime);
		}

	},

	methods: {
		getUserInfos() {
			userInfos({}).then(res => {
				this.$store.commit('setUserInfo', res.data.info ? res.data.info : res.data);
			})
		},

		// 搜索


	}
};